package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.VisitDto;
import com.zzyl.entity.Visit;
import com.zzyl.vo.VisitVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface VisitMapper {

    int update(Visit visit);

    int deleteById(Long id);

    Visit findById(Long id);

    List<Visit> findAll(@Param("mobile") String mobile, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    @Insert("insert into visit(name,mobile,time,visitor,type,status,remark,create_time,update_time,create_by,update_by) " +
            "values(#{name},#{mobile},#{time},#{visitor},#{type},#{status},#{remark},#{createTime},#{updateTime},#{createBy},#{updateBy})")
    void newVisit(VisitVo visit);

    /**
     * 分页查询
     * @param mobile
     * @param name
     * @param status
     * @param type
     * @param startTime
     * @param endTime
     * @return
     */
    List<VisitVo> page(String mobile, String name, Integer status, Integer type, Long startTime, Long endTime);
}
